package com.ruoyi.manage.cms.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.ListUtil;
import com.ruoyi.manage.cms.mapper.HbNewsMapper;
import com.ruoyi.manage.cms.service.IHbNewsService;
import com.ruoyi.manage.cms.domain.HbNews;
import org.springframework.stereotype.Service;


/**
 * newsService业务层处理
 *
 * @author ruoyi
 * @date 2025-07-18
 */
@Service
public class HbNewsServiceImpl extends ServiceImpl<HbNewsMapper, HbNews> implements IHbNewsService {


    @Override
    public HbNews queryGetById(String id) {
        HbNews hbNews = this.getById(id);
        return hbNews;
    }

    /**
     * 新增news
     *
     * @param hbNews news
     * @return 结果
     */
    @Override
    public boolean addHbNews(HbNews hbNews) {
        boolean save = this.save(hbNews);
        return save;
    }

    /**
     * 修改news
     *
     * @param hbNews news
     * @return 结果
     */
    @Override
    public boolean updateHbNews(HbNews hbNews) {
        return this.updateById(hbNews);
    }

    /**
     * 批量删除news
     *
     * @param ids 需要删除的news主键
     * @return 结果
     */
    @Override
    public boolean deleteHbNewsByIds(String[] ids) {
//        List<String> list = ListUtil.toList(ids);
//        List<HbNews> newList = Collections.emptyList();
//        list.forEach(id -> {
//            HbNews hbNews = new HbNews();
//            hbNews.setId(id);
//            hbNews.setIsDeleted(1);
//            newList.add(hbNews);
//        });

        return  this.removeByIds(ListUtil.toList(ids));
    }

}
